<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('村详情')" />
    <style>
        .value {margin-left: 0 !important;}
    </style>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-md-12 search-collapse">
            <div class="select-list">
                <p class="select-title" th:text="${dept.deptName} + 洁净煤信息系统"></p>
                <ul class="col-md-10">
                    <li th:text="总购洁净煤： + ${cunTotalOrder} + 吨"></li>
                </ul>
            </div>
            <form>
                <input th:value="${dept.deptId}" type="hidden" name="village">
            </form>
        </div>
        <div class="col-sm-12 select-table table-bordered">
            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" style="background-color: #7a5674;border-color: #7a5674;"
                   onclick="$.table.exportExcel()">
                    <i th:text="导出表格" class="fa fa-download"></i>
                </a>
            </div>
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var villageId = [[${villageId}]];
var prefix = ctx + "jjm/clientUser";
var keepwarmTypeDatas = [[${@dict.getType('keep_warm_type')}]];
var exportUrl = prefix + "/export";
if(villageId && villageId != "null"){
    exportUrl = exportUrl+"?villageId="+villageId;
}
var deptLevel = [[${user.deptLevel}]]
$(function() {
    var options = {
        url: prefix + "/list?villageId=" + villageId,
        updateUrl: prefix + "/edit/{id}",
        exportUrl: exportUrl,
        modalName: "村民信息",
        showSearch: false,
        showRefresh: false,
        showToggle: false,
        showColumns: false,
        sortName: "id",
        sortOrder: "desc",
        columns: [{
            field: 'id',
            title: 'ID',
            visible: false
        },
            {
                field: 'index',
                title: '编号',
                formatter: function(value, row, index) {
                    return $.table.serialNumber(index);
                }
            },
        {
            field: 'masterName',
            title: '户主姓名'
        },
        {
            field: 'masterIdentityCardNumber',
            title: '身份证号'
        },
        {
            field: 'masterPhoneNumber',
            title: '手机号'
        },
        {
            field: 'keepwarmType',
            title: '取暖方式',
            formatter: function(value, row, index) {
               return $.table.selectDictLabel(keepwarmTypeDatas, value);
            }
        },
        {
            field: 'totalAmount',
            title: '购洁净煤总量(吨)'
        },
        {
            title: '操作',
            align: 'center',
            formatter: function(value, row, index) {
                var actions = [];
                actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="openDetail(\''+row.id+'\')"><i class="fa"></i>查看详情</a> ');
                if(deptLevel && deptLevel > 2) {
                    actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="$.operate.editFull(\'' + row.id + '\')"><i class="fa fa-edit"></i>修改</a> ');
                }
                return actions.join('');
            }
        }]
    };
    $.table.init(options);
});

function openDetail(id) {
    if(isPC()){
        $.modal.openTab('居民信息详情','/jjm/clientUser/clientUserInfo/' + id );
    }else{
        $.modal.openTab('居民信息详情','/mobile/client/' + id );
    }
}
</script>
</body>
</html>